<?php

namespace App\Admin\Actions\Grid\Row\SwtTyGood;

use App\Admin\Forms\AddToGoodsForm;
use Dcat\Admin\Grid\RowAction;
use Dcat\Admin\Widgets\Modal;

class AddToGoods extends RowAction
{
    /**
     * @return string
     */
    protected $title = '加入商品库';

    /**
     * @return string
     */

    public function render()
    {
        $form = AddToGoodsForm::make()->payload(['id' => $this->getKey()]);

        return Modal::make()
            ->xl()
            ->title($this->title)
            ->body($form)
            ->button($this->html());
    }

    protected function html()
    {
        return <<<HTML
            <a {$this->formatHtmlAttributes()}><i class="feather icon-upload text-info"></i> <span class="text-info">{$this->title}</span> &emsp;</a>
        HTML;
    }
}
